package com.itheima.mp.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.mp.domain.po.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author bloodyhooker
 */
public interface UserMapper extends BaseMapper<User> {

    void updateBalanceById(@Param("ew") QueryWrapper<User> wrapper, @Param("amount") int amount);

    @Update("Update user set balance = balance - #{money} WHERE id = #{id}")
    void deductBalance(@Param("id")Long id, @Param("money")Integer money);
}
